package cn.com.dcsgo.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * MyWebAppInitializer
 * 该类用于初始化Spring MVC应用程序上下文
 * 设置dispatcherServlet的映射路径
 *
 * @author Dcsgo
 * @since 2025/2/25 10:52
 */

public class MyWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[0];
    }

    /**
     * 项目的配置类
     *
     * @return {MvcConfig.class}
     */
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{MvcConfig.class};
    }

    /**
     * 设置dispatcherServlet的映射路径
     *
     * @return String[]
     */
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
